<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <th:block th:include="include :: header('历史巡站列表')"/>
</head>
<body class="gray-bg">
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 search-collapse">
            <form id="formId">
                <div class="select-list">
                    <ul>
                        <li>
                            <label>站点名称：</label>
                            <input id="siteId" name="siteId" type="hidden" />
                            <input type="text" onclick="selectAstSiteTree()" id="siteName" readonly="true" >
                        </li>
                        <li>
                            <label>巡站人：</label>
                            <input type="text" name="userName"/>
                        </li>
                        <li>
                            <label>任务状态：</label>
                            <select name="listStatus" th:with="type=${@dict.getType('ast_renwu_status')}">
                                <option value="">所有</option>
                                <option th:each="dict : ${type}" th:text="${dict.dictLabel}"
                                        th:value="${dict.dictValue}"></option>
                            </select>
                        </li>

                        <li class="select-time">
                            <label>完成时间： </label>
                            <input type="text" class="time-input" id="startTime" placeholder="开始时间"
                                   name="params[beginTime]"/>
                            <span>-</span>
                            <input type="text" class="time-input" id="endTime" placeholder="结束时间"
                                   name="params[endTime]"/>
                        </li>
                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i
                                    class="fa fa-search"></i>&nbsp;搜索</a>
                            <a class="btn btn-warning btn-rounded btn-sm" onclick="chongzhi()"><i
                                    class="fa fa-refresh"></i>&nbsp;重置</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>

        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table"></table>
        </div>
    </div>
</div>
<th:block th:include="include :: footer"/>
<script th:inline="javascript">
    var listStatusDatas = [[${@dict.getType('ast_renwu_status')}]];
    var prefix = ctx + "asset/taskUserList";

    $(function () {
        var options = {
            url: prefix + "/list",
            createUrl: prefix + "/add",
            updateUrl: prefix + "/edit/{id}",
            removeUrl: prefix + "/remove",
            exportUrl: prefix + "/export",
            modalName: "历史巡站",
            columns: [{
                checkbox: true
            },
                {
                    field: 'userName',
                    title: '巡站人'
                },
                {
                    field: 'siteName',
                    title: '站点名称'
                },
                {
                    field: 'listStatus',
                    title: '任务状态',
                    formatter: function (value, row, index) {
                        return $.table.selectDictLabel(listStatusDatas, value);
                    }
                },
                {
                    field: 'listAloneDescribe',
                    title: '任务描述'
                },
                {
                    field: 'completeTime',
                    title: '完成时间'
                },
                {
                    field: 'deviceNoDescribe',
                    title: '异常设备描述'
                }]
        };
        $.table.init(options);
    });

    /*站点管理-新增-选择父站点管理树*/
    function selectAstSiteTree() {
        var options = {
            title: '站点管理选择',
            width: "380",
            url: ctx + "asset/astSite/selectAstSiteTree/0",
            callBack: doSubmit2
        };
        $.modal.openOptions(options);
    }

    function doSubmit2(index, layero){
        var body = $.modal.getChildFrame(index);
        $("#siteId").val(body.find('#treeId').val());
        $("#siteName").val(body.find('#treeName').val());
        $.modal.close(index);
    }

    function chongzhi() {
        $("#siteId").val("")
        $.form.reset()
    }

</script>
</body>
</html>